﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Commonlib;

namespace AlbonWeb.Manager.OrderManager
{
    public partial class ChangeClass : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            { 
                if(Request["orderid"]!=null)
                {
                    //绑定订单类别
                    SqlHelper.BindDropDownList(ddlClass, "className", "ID", SqlHelper.SqlConnectionString, CommandType.Text, "select * from OrderClass", null);
                    //初始化数据
                    BLL.OrderBLL orderbll = new BLL.OrderBLL();
                    DataTable dt=orderbll.getOrderByID(Request["orderid"].ToString());
                    refNo.Text = dt.Rows[0]["refNo"].ToString();
                    className.Text = dt.Rows[0]["className"].ToString();
                    ddlClass.SelectedValue = dt.Rows[0]["classID"].ToString();
                }
            }
        }

        //提交
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            if (Request["orderid"] != null)
            {
                Albon.Model.OrderInfo order = new Albon.Model.OrderInfo();
                order.ID = int.Parse(Request["orderid"].ToString());
                order.classID = int.Parse(ddlClass.SelectedValue);
                BLL.OrderBLL orderbll = new BLL.OrderBLL();
                orderbll.MoveOrder(order);
            }
        }
    }
}